package com.pocket.demo.business.dao;

import com.pocket.demo.business.po.Role;
import com.pocket.demo.core.mybatis.PocketBaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * @author cookie.
 **/
@Mapper
public interface RoleMapper extends PocketBaseMapper<Role> {

    @Select("SELECT r.* FROM role r JOIN user_role ur ON r.role_id = ur.role_id WHERE ur.user_id = #{userId}")
    List<Role> listByUserId(@Param("userId") Long userId);
}